﻿package org.openChart.sprite.elements 
{
	import flash.display.Sprite;
	import org.openChart.display.DisplayElement;
	import flash.events.MouseEvent;
	import org.openChart.display.chart.DisplayBarElement;
	import org.openChart.meta.BarChart;
	import org.openChart.sprite.CommandHandler;
	/**
	 * ...
	 * @author Chongyuan
	 */
	public class LineElement extends BarElementSprite
	{
		
		private var size:uint;
		public function LineElement(displayElement:DisplayElement, commandHandler:CommandHandler)
		{
			var displayElement_:DisplayBarElement = displayElement as DisplayBarElement;
			size = displayElement_.size;
			super(displayElement, commandHandler);
			
		}
		
		public override function paint():void
		{
			var displayElement:DisplayBarElement = displayObject as DisplayBarElement;
			graphics.clear();
			fillEllipse(displayObject.position.x + displayElement.width / 2, displayObject.position.y - displayElement.height, size / 2, size / 2, color);
		}
		
		
		public override function mouseOver( event:MouseEvent ):void
		{
			var displayElement:DisplayBarElement = displayObject as DisplayBarElement;
			size = displayElement.selectedSize;
			super.mouseOver(event);
		}
		
		public override function mouseOut( event:MouseEvent ):void
		{
			var displayElement:DisplayBarElement = displayObject as DisplayBarElement;
			size = displayElement.size;
			super.mouseOut(event);
		}
	}
	
}